import request from '@/utils/request'

// 查询库存盘点单(es_stock_inventory)列表
export function listInventory(query) {
  return request({
    url: '/system/inventory/list',
    method: 'get',
    params: query
  })
}

// 查询部门列表
export function listDept() {
  return request({
    url: '/system/dept/list',
    method: 'get'
  })
}

// 查询仓库列表
export function listWarehouse() {
  return request({
    url: '/system/warehouse/list',
    method: 'get'
  })
}

// 查询库存盘点单(es_stock_inventory)详细
export function getInventory(id) {
  return request({
    url: '/system/inventory/' + id,
    method: 'get'
  })
}

// 新增库存盘点单(es_stock_inventory)
export function addInventory(data) {
  return request({
    url: '/system/inventory',
    method: 'post',
    data: data
  })
}

// 修改库存盘点单(es_stock_inventory)
export function updateInventory(data) {
  return request({
    url: '/system/inventory',
    method: 'put',
    data: data
  })
}

// 删除库存盘点单(es_stock_inventory)
export function delInventory(id) {
  return request({
    url: '/system/inventory/' + id,
    method: 'delete'
  })
}

// 审核库存盘点单
export function auditInventory(id) {
  return request({
    url: `/system/inventory/audit/${id}`,
    method: 'put'
  });
}

// 根据仓库ID获取商品列表
export function listGoodsByWarehouse(warehouseId, keyword) {
  return request({
    url: '/api/warehouse/' + warehouseId + '/goods',
    method: 'get',
    params: { keyword }
  })
}

// 获取盘亏盘盈统计
export function getProfitLossStats() {
  return request({
    url: '/system/inventory/profitLossStats',
    method: 'get'
  })
}


